/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package rigo.ricard.pris.rs.ac.uns.dmi.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import rigo.ricard.pris.rs.ac.uns.dmi.model.Advertising;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing Advertising in entity cache.
 *
 * @author Rigo Richard
 * @see Advertising
 * @generated
 */
public class AdvertisingCacheModel implements CacheModel<Advertising>,
	Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(21);

		sb.append("{adId=");
		sb.append(adId);
		sb.append(", userId=");
		sb.append(userId);
		sb.append(", userName=");
		sb.append(userName);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", modifiedDate=");
		sb.append(modifiedDate);
		sb.append(", carManufacturerId=");
		sb.append(carManufacturerId);
		sb.append(", carModelId=");
		sb.append(carModelId);
		sb.append(", carDescription=");
		sb.append(carDescription);
		sb.append(", location=");
		sb.append(location);
		sb.append(", price=");
		sb.append(price);
		sb.append("}");

		return sb.toString();
	}

	public Advertising toEntityModel() {
		AdvertisingImpl advertisingImpl = new AdvertisingImpl();

		advertisingImpl.setAdId(adId);
		advertisingImpl.setUserId(userId);

		if (userName == null) {
			advertisingImpl.setUserName(StringPool.BLANK);
		}
		else {
			advertisingImpl.setUserName(userName);
		}

		if (createDate == Long.MIN_VALUE) {
			advertisingImpl.setCreateDate(null);
		}
		else {
			advertisingImpl.setCreateDate(new Date(createDate));
		}

		if (modifiedDate == Long.MIN_VALUE) {
			advertisingImpl.setModifiedDate(null);
		}
		else {
			advertisingImpl.setModifiedDate(new Date(modifiedDate));
		}

		advertisingImpl.setCarManufacturerId(carManufacturerId);
		advertisingImpl.setCarModelId(carModelId);

		if (carDescription == null) {
			advertisingImpl.setCarDescription(StringPool.BLANK);
		}
		else {
			advertisingImpl.setCarDescription(carDescription);
		}

		if (location == null) {
			advertisingImpl.setLocation(StringPool.BLANK);
		}
		else {
			advertisingImpl.setLocation(location);
		}

		advertisingImpl.setPrice(price);

		advertisingImpl.resetOriginalValues();

		return advertisingImpl;
	}

	public long adId;
	public long userId;
	public String userName;
	public long createDate;
	public long modifiedDate;
	public long carManufacturerId;
	public long carModelId;
	public String carDescription;
	public String location;
	public double price;
}